怎样用C语言编写"输入一个字符串,将其中的大写字母改小写,然后在将其小写改为大写"

来源:百度知道 编辑:UC知道 时间:2024/05/12 00:53:21
最好全部编写出来

#include<stdio.h>
main()
{
char c;
while((c=getchar())!='\n')
{
if(c>='a'&&c<='z')
c=c-32;
else
if(c>='A'&&c<='Z')
c=c+32;
printf("%c",c);
}
printf("\n");
}

经本人亲自编写并测试,如有不懂请Q我172610236

------------------------------------
经过运行
#include<stdio.h>
main()
{
char a[100];//最多输入100个字符
int i,j;
printf("plsea input a[].\n");
gets(a);

for(i=0;a[i]!='\0';i++)
{
if(a[i]>='a' && a[i]<='z') a[i]=a[i]-32;else
if(a[i]>='A' && a[i]<='Z') {a[i]=a[i]+32;continue;}
}
for(i=0;a[i]!='\0';i++)
printf("%c",a[i]);
printf("\n");
}

#include<stdio.h>
main()
{
char s[];
int i=0;
for(i=0;;i++